import {
    DeviceEventEmitter
} from 'react-native';

export const emit = (type: string, para?: any) => (
    DeviceEventEmitter.emit(type, para)
)

export const add = (type: string, fn: Function|any): Function => {
    const event = DeviceEventEmitter.addListener(type, fn);
    return () => event.remove();
}

//用户登出监听
export const ON_USER_OUT:string = `on/user/out`;

//用户登录监听
export const ON_USER_LOGIN:string = `on/user/login`;

//进入首页
export const ON_ENTER_HOME:string = `on/enter/home`;

//完全暂停视频
export const STOP_VIDEO_PLAY:string = `stop/video/play`;